package sgi.client;



import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JTextField;

import sgi.details_new.AccountInfoDetails;
import sgi.details_new.TariffDetails;
import sgi.user.User;

@SuppressWarnings("serial")
public class SGIViewTariffUI extends JFrame {
	private SGIViewTariffController ViewTariffController;
	private JTextField ImageField;
	private JTextField TimeLocationField;
	private JTextField ImagePackField;
	private JTextField DataLayerField;

	/** setting buttons and text fields */
	public SGIViewTariffUI()  {
		setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
		getContentPane().setEnabled(false);
		setBounds(100, 100, 802, 276);
		getContentPane().setLayout(null);
		//setResizable(false);
		JLabel lblImage = new JLabel("Image price:");
		lblImage.setBounds(10, 36, 240, 35);
		getContentPane().add(lblImage);
		
		ImageField = new JTextField();
		ImageField.setBounds(260, 40, 147, 26);
		getContentPane().add(ImageField);
		ImageField.setColumns(10);
		ImageField.setEditable(false);
		
		JLabel lblTimeLocation = new JLabel("Time Location Subscription Price: ");
		lblTimeLocation.setBounds(10, 101, 240, 35);
		getContentPane().add(lblTimeLocation);
		
		TimeLocationField = new JTextField();
		TimeLocationField.setBounds(260, 105, 147, 26);
		getContentPane().add(TimeLocationField);
		TimeLocationField.setColumns(10);
		TimeLocationField.setEditable(false);
		
		JLabel lblImagePack = new JLabel("Image Pack Subscription Price: ");
		lblImagePack.setBounds(417, 101, 202, 35);
		getContentPane().add(lblImagePack);
		
		ImagePackField = new JTextField();
		ImagePackField.setBounds(629, 105, 147, 26);
		getContentPane().add(ImagePackField);
		ImagePackField.setColumns(10);
		ImagePackField.setEditable(false);
		
		JLabel lblDataLayer = new JLabel("Data Layer Subscription Price: ");
		lblDataLayer.setBounds(424, 36, 195, 35);
		getContentPane().add(lblDataLayer);
		
		DataLayerField = new JTextField();
		DataLayerField.setBounds(629, 40, 147, 26);
		getContentPane().add(DataLayerField);
		DataLayerField.setColumns(10);
		DataLayerField.setEditable(false);
		
			
		JButton btnReturn = new JButton("Return");
		btnReturn.addActionListener(new ActionListener() {
		public void actionPerformed(ActionEvent arg0) {
			SGIViewTariffController.terminate();
			SGIUserAccountMenuController.create(null);
			}
		});
		btnReturn.setBounds(629, 182, 147, 47);
		getContentPane().add(btnReturn);
		

		
	}
	/** get controller */
	public SGIViewTariffController getViewTariffController() {
		return ViewTariffController;
	}
	
	/** setting the controller */
	public void setSGIViewTariffController(SGIViewTariffController ViewTariffController) {
		this.ViewTariffController = ViewTariffController;
	}
	
	/** setting all fields in tariff info */
	public void addTariffInfo(TariffDetails aid)
	{
		ImageField.setText(aid.getImage());
		TimeLocationField.setText(aid.getDateTimePrice());
		ImagePackField.setText(aid.getImagePackPrice());
		DataLayerField.setText(aid.getDataLayerPrice());
	}
	/** review the UI */
	public void review()
	{
		ViewTariffController.ViewInfo();
	}
}
